#pragma once
#include "Math.h"
#include "Shaders.h"
#include "../Utilities/utilities.h"
#include "Camera.h"

#define NUM_PARTICLES 360
#define PI 3.14159265

enum ParticleType
{
	BEAM = 0,
	EXPLOSION = 1
};

enum ParticleStatus
{
	STOPPED = -1,
	PLAYING = 0
};

struct Particle
{
	Vector3 Position;
	Vector3 Velocity;
	Vector3 Gravity;
	float LifeTime;
};

class ParticleSystem
{
	ParticleStatus m_Status;
	float m_totalTime;
	float m_lifeTime;
	GLuint vbo, texture_id;
	GLuint a_posL, a_velocityL, u_gravityW, u_lifetime, u_mvp, u_texture, u_totaltime, u_speed, u_distanceToCamera;
	Shaders myShaders;
public:
	int Init(float lifeTime, ParticleType type = ParticleType::EXPLOSION);
	void Update(float deltaTime);
	void Draw(Camera* camera);
	void Play() { m_Status = ParticleStatus::PLAYING; }
	void Stop() { m_Status = ParticleStatus::STOPPED; }
	ParticleSystem();
	~ParticleSystem();

private:
	Vector3 m_Position, m_Scale, m_Rotation;
};

